package com.azxc.rapid.plus.system.feign;


import com.azxc.rapid.core.tenant.annotation.NonDS;
import com.azxc.rapid.core.tool.api.R;
import com.azxc.rapid.plus.dict.feign.IDictBizPlusClient;
import com.azxc.rapid.plus.system.service.IDictBizPlusService;
import com.azxc.rapid.system.entity.DictBiz;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;


/**
 * 字典服务Feign实现类
 */
@NonDS
@ApiIgnore
@RestController
@RequiredArgsConstructor
public class DictBizPlusClient implements IDictBizPlusClient {

	private final IDictBizPlusService service;


	@Override
	public R<List<DictBiz>> getListByTenantid(String code, String tenantId) {
		LambdaQueryWrapper<DictBiz> wrapper = new LambdaQueryWrapper();
		wrapper.eq(DictBiz::getCode, code)
			.eq(DictBiz::getTenantId, tenantId)
			.eq(DictBiz::getIsDeleted, 0)
			.eq(DictBiz::getIsSealed, 0)
			.gt(DictBiz::getParentId, 0);
		List<DictBiz> rlist = service.list(wrapper);
		return R.data(rlist);
	}

}
